<?php
session_start();
include_once "../apps/ManagerIUDS.php";
$managerIUDS = new ManagerIUDS();

$mode = $_POST["mode"];
$loginName = $_POST["login_name"];
$password = $_POST["password"];

if($mode == "chk_login"){
	$arrData["user_name"] = "".$loginName."";
	$arrData["password"] = "".$password."";
	$data = $managerIUDS->queryData("user_name,password,user_type,name", "user", " WHERE user_name='".$loginName."' AND password = '".$password."'" , "1", "");
	if(sizeof($data)>0){
		$_SESSION["user_name"] = $data["user_name"];
		$_SESSION["name"] = $data["name"];
		$_SESSION["user_type"] = $data["user_type"];
		header("Location:../home.php");
	}else{
		header("Location:../index.php");
	}
}else{
	header("Location:../index.php");
}
?>